namespace Test
{
    using System;
    using GeoWeb.DataContext;


    /// <summary>
    /// 表名：Country 主键列：
    /// </summary>
    [SerializableAttribute()]
    public partial class Country : Entity
    {

        protected Int32 _UID;

        protected String _ISO;

        protected String _Name;

        protected String _PrintableName;

        protected String _ISO3;

        protected String _Numcode;

        public Int32 UID
        {
            get
            {
                return this._UID;
            }
            set
            {
                this.OnPropertyValueChange(_.UID, _UID, value);
                this._UID = value;
            }
        }

        public String ISO
        {
            get
            {
                return this._ISO;
            }
            set
            {
                this.OnPropertyValueChange(_.ISO, _ISO, value);
                this._ISO = value;
            }
        }

        public String Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this.OnPropertyValueChange(_.Name, _Name, value);
                this._Name = value;
            }
        }

        public String PrintableName
        {
            get
            {
                return this._PrintableName;
            }
            set
            {
                this.OnPropertyValueChange(_.PrintableName, _PrintableName, value);
                this._PrintableName = value;
            }
        }

        public String ISO3
        {
            get
            {
                return this._ISO3;
            }
            set
            {
                this.OnPropertyValueChange(_.ISO3, _ISO3, value);
                this._ISO3 = value;
            }
        }

        public String Numcode
        {
            get
            {
                return this._Numcode;
            }
            set
            {
                this.OnPropertyValueChange(_.Numcode, _Numcode, value);
                this._Numcode = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<Country>("Country");
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.UID,
                        _.ISO,
                        _.Name,
                        _.PrintableName,
                        _.ISO3,
                        _.Numcode};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._UID,
                        this._ISO,
                        this._Name,
                        this._PrintableName,
                        this._ISO3,
                        this._Numcode};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.UID)))
            {
                this._UID = reader.GetInt32(_.UID);
            }
            if ((false == reader.IsDBNull(_.ISO)))
            {
                this._ISO = reader.GetString(_.ISO);
            }
            if ((false == reader.IsDBNull(_.Name)))
            {
                this._Name = reader.GetString(_.Name);
            }
            if ((false == reader.IsDBNull(_.PrintableName)))
            {
                this._PrintableName = reader.GetString(_.PrintableName);
            }
            if ((false == reader.IsDBNull(_.ISO3)))
            {
                this._ISO3 = reader.GetString(_.ISO3);
            }
            if ((false == reader.IsDBNull(_.Numcode)))
            {
                this._Numcode = reader.GetString(_.Numcode);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(Country).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<Country>();

            /// <summary>
            /// 字段名：UID - 数据类型：Int32
            /// </summary>
            public static Field UID = new Field<Country>("UID");

            /// <summary>
            /// 字段名：ISO - 数据类型：String
            /// </summary>
            public static Field ISO = new Field<Country>("ISO");

            /// <summary>
            /// 字段名：Name - 数据类型：String
            /// </summary>
            public static Field Name = new Field<Country>("Name");

            /// <summary>
            /// 字段名：PrintableName - 数据类型：String
            /// </summary>
            public static Field PrintableName = new Field<Country>("PrintableName");

            /// <summary>
            /// 字段名：ISO3 - 数据类型：String
            /// </summary>
            public static Field ISO3 = new Field<Country>("ISO3");

            /// <summary>
            /// 字段名：Numcode - 数据类型：String
            /// </summary>
            public static Field Numcode = new Field<Country>("Numcode");
        }
    }
}
